/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanelListarGruposEstudio.java
 *
 * Created on 29/10/2014, 12:22:26 PM
 */
package mx.com.ugto.caadi.asistencias.gui;

import java.util.List;
import mx.com.ugto.caadi.asistencias.bean.view.MateriaView;
import mx.com.ugto.caadi.asistencias.gui.model.ModeloTablaMateriasDadasAlta;
import mx.com.ugto.caadi.asistencias.sql.MateriaSQL;

/**
 *
 * @author Maestria
 */
public class PanelListarGruposEstudio extends javax.swing.JPanel {

    private ModeloTablaMateriasDadasAlta modeloTabla;

    /** Creates new form PanelListarGruposEstudio */
    public PanelListarGruposEstudio() {
        initComponents();
        modeloTabla = new ModeloTablaMateriasDadasAlta();
        tblGruposEstudio.setModel(modeloTabla);
    }

    void cargarDatosTabla() {
        modeloTabla = new ModeloTablaMateriasDadasAlta();
        List<MateriaView> lstAlumnos = MateriaSQL.listarMaterias();
        for (MateriaView alumno : lstAlumnos) {
            modeloTabla.agregarMateria(alumno);
        }
        tblGruposEstudio.setModel(modeloTabla);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlBotones = new javax.swing.JPanel();
        btnEliminar = new javax.swing.JButton();
        btnLstAlumnos = new javax.swing.JButton();
        scrGruposEstudio = new javax.swing.JScrollPane();
        tblGruposEstudio = new javax.swing.JTable();

        setLayout(new java.awt.BorderLayout());

        pnlBotones.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        btnEliminar.setText("Eliminar");
        pnlBotones.add(btnEliminar);

        btnLstAlumnos.setText("Ver alumnos");
        pnlBotones.add(btnLstAlumnos);

        add(pnlBotones, java.awt.BorderLayout.PAGE_START);

        tblGruposEstudio.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        scrGruposEstudio.setViewportView(tblGruposEstudio);

        add(scrGruposEstudio, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnEliminar;
    private javax.swing.JButton btnLstAlumnos;
    private javax.swing.JPanel pnlBotones;
    private javax.swing.JScrollPane scrGruposEstudio;
    private javax.swing.JTable tblGruposEstudio;
    // End of variables declaration//GEN-END:variables
}
